package vip.xiaozhao.paotui.intf.enums;

/** 跑腿进行中状态**/
public enum PaotuiGoingStatusEnum {

    Canceled(0, "已取消接单", 1),
    YiJieDan(1, "任务已接单",1),//只有该状态显示在任务列表中
    Gotten(2, "物品正常取到",1),
    FailGotten(3, "物品未正常取到",1),
    Broken(4, "物品已损坏",1),
    Sended(5, "物品已通知送达",1),
    AckSended(6, "物品确认收到",2),
    FailAckSended(7, " 物品未确认收到",2),
    AckSendedButWrong(8, " 物品确认有问题",2),
    Ended(9, "任务正常结束",3),
    RenGong(10, "转人工",3);

    private int id;
    private String name;
    private int roleId; //1是跑腿人，2是发布人, 3 双方

    PaotuiGoingStatusEnum(int id, String name, int roleId) {
        this.id = id;
        this.name = name;
        this.roleId = roleId;
    }

    public static PaotuiGoingStatusEnum getById(int id) {
        for (PaotuiGoingStatusEnum type : PaotuiGoingStatusEnum.values()) {
            if (type.getId() == id)
                return type;
        }
        return null;
    }

    public static boolean isEndedStatus(PaotuiGoingStatusEnum statusEnum){
        if(statusEnum == Canceled || statusEnum == Ended || statusEnum == RenGong){
            return true;
        }
        return  false;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Setter method for property <tt>name</tt>.
     *
     * @param name value to be assigned to property name
     */
    public void setName(String name) {
        this.name = name;
    }

    public int getRoleId() {
        return roleId;
    }

    public void setRoleId(int roleId) {
        this.roleId = roleId;
    }

    public static void main(String[] args) {
        System.out.println(getById(1).getName());
    }

}
